<%= content_for :header_title, @status.nil? ? '创建博客' : '更新内容' %>
<style type="text/css">
  .cus_select{
      width: 150px;
  }


</style>
<%= content_for :page_content do %>

    <div class="page-content">
      <div class="page-header">

      </div><!-- /.page-header -->
      <%# 只有基本的模型类才可使用记录辨识技术，也就是不能有url选项 %>
<%= form_for(@post ,url: (@post.new_record? ? manager_blog_blogs_path : manager_blog_blog_path)) do |f| %>
      <div class="row">
        <div class="col-xs-12">
          <!-- PAGE CONTENT BEGINS -->
            <%= f.hidden_field :id, value: @post.id %>
            <%= render partial: 'bootstrap_ligntweight_editor' %>
          <textarea id="ta" hidden="hidden"><%= @post.content unless @post.nil? %></textarea>
          <script type="text/javascript">
              /*将混有html代码的博客内容处理后从新载入富文本编辑器中*/
              $(document).ready(function(){
                  var c = $("#ta").text();
                  $("div#editor1").html(c);
              })
          </script>

          <!-- PAGE CONTENT ENDS -->
        </div><!-- /.col -->
      </div><!-- /.row -->

      <div class="row">
        <div class="col-xs-12">
           <span>博客分类：</span>

          <%= select_tag "post[blog_sort_id]" ,options_from_collection_for_select(@blog_sorts, :id, :sort_name,(@post.blog_sort_id unless @post.blank?) ),class: 'cus_select' %>


        </div>
      </div>

      <div class="row">
        <div class="col-xs-12">

          <button id="editor-save" class="btn btn-app btn-grey btn-xs radius-4" type="submit">
            <i class="icon-save bigger-160"></i>
            Save
            <span class="badge badge-transparent">
                <i class="light-red icon-asterisk"></i>
            </span>
          </button>
          <script type="text/javascript">
              var $editor_id = '#editor1';
              var $editor_save = '#editor-save';
              var $editor_value = '#post_content';
              /*将文本编辑器中的html代码放入到textarea中*/
              $($editor_save).click(function(){
                  var $editor_html =  $($editor_id).html();

                  $($editor_value).text($editor_html);

              });

          </script>
        </div>
      </div>
    <% end %>

    </div><!-- /.page-content -->


<%end %>